/********************************************************************
* PROJECT CODE :                                  
* CREATE DATE  :                                       
* CREATED BY   :                                          
* FUNCTION     :                                          
* MODIFY DATE  :                                          
* DOCUMENT     :                                         
* OTHERS       :  
********************************************************************/

#ifndef FLASH_H
#define FLASH_H


/* ------------------------------------------------------------------------------------------------
 *                                           Includes
 * ------------------------------------------------------------------------------------------------
 */
#include "bsp_board_defs.h"
//#include "bsp_macros.h"
//#include "hal_types.h"

/* One whole page of flash memory is to be reserved, i.e., 1 KiB. */
#define PAGE_SIZE 250
/* String length (exluding the terminal '\0'). */
#define DATA_AMOUNT 32
#define ENABLE_GLOBAL_INTERRUPT EA = 1//
#define DISABLE_GLOBAL_INTERRUPT EA = 0//


extern struct FLASH               //
{ 
  uint8_t readBuf[30];                   
  uint8_t b;
}flash;


void flashWrite(uint8_t *Data, uint8_t Addr, uint16_t num);
void flashRead(uint8_t *Data, uint8_t Addr, uint8_t num);

unsigned char ReadOneByteFromFlash(unsigned char* cbpPointer);
void flashRead2(uint8_t *Data, uint8_t Addr, uint8_t num);
void flashRead3(uint8_t *Data, uint8_t Addr, uint8_t num);

#endif
